package top.myhdg.bijou.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import top.myhdg.bijou.R;

public class SourceActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_source);

        Intent intent = getIntent();
        String html = intent.getStringExtra("Html");

        EditText source = findViewById(R.id.editTextSource);
        if (html == null) {
            source.setGravity(Gravity.CENTER);
            source.setText("\n\n\n\n\n\n\n\n\n\n请等待网页加载完成后再进入该页查看源码");
        } else {
            source.setText(html);
        }

        Button exitSource = findViewById(R.id.exitSource);
        exitSource.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SourceActivity.this.finish();
            }
        });
    }
}
